/* 基础设置 */
:root {
    --primary-color: #4361ee;
    --secondary-color: #3f37c9;
    --accent-color: #4895ef;
    --text-color: #180303;
    --light-bg: #1a1a2e;
    --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;700&display=swap');

body {
    font-family: 'Noto Sans SC', sans-serif;
    background-color: var(--light-bg);
    color: var(--text-color);
    background: linear-gradient(135deg, #2626a8 0%, #16213e 100%);
    padding: 0;
    margin: 0;
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    color: var(--text-color); /* 确保基础文字颜色 */
    background-image: url('imgaes/bk.png');
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    background-attachment: fixed;
    
    /* 确保内容可读性 */
    background-color: rgba(0, 0, 0, 0.5); /* 半透明黑色遮罩 */
    background-blend-mode: overlay;
    
    /* 字体优化 */
    color: white; /* 浅色文字确保可读 */
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* 容器样式 */
.poll-container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 2rem;
    background-color: rgba(30, 30, 46, 0.96);
    color: var(--text-color);

    background-color: rgba(255, 255, 255, 0.85); /* 浅色半透明背景 */
    backdrop-filter: blur(5px);
    box-shadow: var(--card-shadow);
}

.poll-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.poll-header h1 {
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
    font-size: 2rem;
}

.poll-header .icon {
    display: inline-block;
    margin-right: 10px;
}

.subtitle {
    color: #6c757d;
    margin-top: 0.5rem;
}

/* 投票列表项 */
.poll-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.poll-item {
    margin-bottom: 1rem;
    transition: all 0.3s ease;
    border-radius: 12px;
    overflow: hidden;
}

.poll-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    text-decoration: none;
    color: var(--text-color);
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.poll-link:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(67, 97, 238, 0.15);
    border-color: var(--accent-color);
}

.poll-text {
    font-weight: 500;
    flex-grow: 1;
}

.poll-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.vote-count {
    font-size: 0.85rem;
    color: #6c757d;
    background: rgba(0, 0, 0, 0.03);
    padding: 0.3rem 0.6rem;
    border-radius: 50px;
}

.arrow {
    color: var(--accent-color);
    font-weight: bold;
    transition: transform 0.2s;
}

.poll-link:hover .arrow {
    transform: translateX(3px);
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 12px;
}

.empty-icon {
    font-size: 3rem;
    opacity: 0.5;
    margin-bottom: 1rem;
}

.empty-state h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: #6c757d;
    margin: 0;
}

/* 页脚 */
.poll-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    color: #6c757d;
    font-size: 0.9rem;
}

.counter {
    font-weight: bold;
    color: var(--primary-color);
}

/* 响应式设计 */
/* 将媒体查询合并到相关样式块中 */
@media (max-width: 768px) {
    .poll-container {
        margin: 0;
        padding: 1.5rem;
        border-radius: 0;
        min-height: 100vh;
    }
    
    .poll-link {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .poll-meta {
        width: 100%;
        justify-content: space-between;
    }
}

/* 修复不匹配的大括号 */
    /* 投票结果页特定样式 */
.result-container {
    max-width: 700px;
}

.result-content {
    padding: 1.5rem 0;
}

.result-list {
    list-style: none;
    padding: 0;
    margin: 0 0 2rem 0;
}

.result-item {
    margin-bottom: 1.5rem;
}

.choice-text {
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.vote-progress {
    height: 28px; /* 稍微降低高度 */
    background: rgba(0, 0, 0, 0.05);
    border-radius: 15px;
    position: relative;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, 
    var(--primary-color), 
    color-mix(in srgb, var(--primary-color), white 20%));
    border-radius: 15px;
    transition: width 0.8s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.vote-count {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.85rem;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.total-votes {
    text-align: center;
    padding: 1rem;
    background: rgba(0,0,0,0.03);
    border-radius: 8px;
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

/* 投票表单页特定样式 */
.vote-container {
    max-width: 600px;
}

.vote-form {
    padding: 1.5rem 0;
}

.error-message {
    background: #fff0f0;
    color: #d32f2f;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-left: 4px solid #d32f2f;
}

.choices-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-bottom: 2rem;
}

.choice-item {
    display: flex;
    align-items: center;
    padding: 1rem 1.2rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.08);
    cursor: pointer;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
}

.choice-item:hover {
    border-color: var(--accent-color);
    box-shadow: 0 2px 8px rgba(67, 97, 238, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.15);
}

.choice-radio {
    opacity: 0;
    position: absolute;
}

.custom-radio {
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-radius: 50%;
    margin-right: 1rem;
    position: relative;
    transition: all 0.2s;
}

.choice-radio:checked + .custom-radio {
    border-color: var(--primary-color);
    background-color: var(--primary-color);
}

.choice-radio:checked + .custom-radio::after {
    content: "";
    position: absolute;
    width: 10px;
    height: 10px;
    background: white;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.choice-radio:focus-visible + .custom-radio {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.choice-text {
    flex-grow: 1;
    color: var(--text-color);
}

/* 按钮样式 */
.action-buttons, .form-footer {
    display: flex;
    justify-content: center;
    flex-direction: column;
    gap: 0.75rem;
}

.btn {
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: transform 0.2s ease-out, box-shadow 0.2s ease-out;
    width: 100%;
    justify-content: center;
}

.btn-revote {
    background: var(--primary-color);
    color: white;
}

.btn-back {
    background: white;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.btn-submit {
    background: var(--primary-color);
    color: white;
    border: none;
    font-size: 1rem;
    cursor: pointer;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.btn-revote:hover, .btn-submit:hover {
    background: var(--secondary-color);
}

.btn-back:hover {
    background: rgba(67, 97, 238, 0.05);
}

.btn:focus, 
.choice-radio:focus + .custom-radio,
input:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.subtitle {
    color: color-mix(in srgb, var(--text-color), transparent 30%);
}

error-message {
    background: #ffebee;
    color: #c62828;
    border-left-color: #c62828;
}

body {
    background: radial-gradient(circle at 20% 30%, 
        rgba(67, 97, 238, 0.8) 0%, 
        rgba(58, 12, 163, 0.9) 40%, 
        rgba(114, 9, 183, 1) 100%);
        
    animation: gradientShift 30s ease infinite; /* 从15s延长到30s减少性能消耗 */
    background-attachment: fixed;
    min-height: 100vh;
    margin: 0;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.poll-container {
    background-color: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(4px);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin: 2rem auto;
    overflow: hidden;
}


@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    }
    .poll-container {
        background-color: rgba(30, 30, 46, 0.9);
        border-color: rgba(255, 255, 255, 0.1);
    }
}

/* 修复暗色模式下的文字颜色 */
@media (prefers-color-scheme: dark) {
    :root {
        --text-color: #f0f0f0;
        --light-bg: #1a1a2e;
    }
    
    .poll-container {
        background-color: rgba(30, 30, 46, 0.85);
        color: var(--text-color);
    }
    
    .choice-text, 
    .subtitle,
    .poll-text {
        color: var(--text-color);
    }
}

/* 确保所有文本元素继承颜色 */
h1, h2, h3, p, span, a, li, label {
    color: inherit;
}